#region Copyright Jonathan Quiros

//	
// All rights are reserved. Reproduction or transmission in whole or in 
// part, in any form or by any means, electronic, mechanical or otherwise, 
// is prohibited without the prior written consent of the copyright owner.
//
// Filename: IUsersRepository.cs
//

#endregion

using System.Collections.Generic;
using Novagoal.Models;
using Novagoal.Models.Utils;
using Ids.Web.Listing;

namespace Novagoal.Repositories
{
    public interface IUsersRepository
    {
        Person GetPerson(string email);

        Person GetPerson(int id);

        /// <summary>
        /// Method that find the user information
        /// </summary>
        /// <param name="username">The username of the user to find</param>
        User GetUser(string username);

        /// <summary>
        /// Method that find the user information
        /// </summary>
        /// <param name="id">The id of the user to find</param>
        User GetUser(int id);

        /// <summary>
        /// Get the list of roles
        /// </summary>
        /// <param name="filterList">Options to filter the list</param>
        /// <param name="sortField">Field to sort the list</param>
        /// <param name="sortDirection">Direction to sort the list</param>
        /// <param name="currentPage">The current page of items</param>
        /// <param name="pageSize">Number of items to take</param>
        /// <returns>List of roles</returns>
        List<User> GetUsers(Dictionary<UserListFilter, string> filterList, UserListSortField sortField,
                            SortDirectionType sortDirection, int currentPage, int pageSize);

        /// <summary>
        /// Get the total of users
        /// </summary>
        /// <param name="filterList">Options to filter the roles</param>
        /// <returns>Number of roles</returns>
        int GetTotalUsers(Dictionary<UserListFilter, string> filterList);

        /// <summary>
        /// Edit a person information
        /// </summary>
        /// <param name="person">Person to edit</param>
        /// <returns>The id of the edited person</returns>
        int EditPerson(Person person);

        /// <summary>
        /// Add a new person
        /// </summary>
        /// <param name="person">Person to add</param>
        /// <returns>The id of the new person</returns>
        int AddPerson(Person person);

        /// <summary>
        /// Edit a user
        /// </summary>
        /// <param name="user">User information</param>
        /// <returns>The user id</returns>
        int EditUser(User user);

        /// <summary>
        /// Add a new user
        /// </summary>
        /// <param name="user">The user information</param>
        /// <returns>The userr id</returns>
        int AddUser(User user);

        /// <summary>
        /// Set the current datetime as the last access
        /// </summary>
        /// <param name="username">User to update</param>
        void UpdateLastAccess(string username);

        void SavePassword(User user);
    }
}